package day14.Ti.XianChengChi;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.*;

public class Ti02 {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newCachedThreadPool();
        Runnable r=new Runnable() {
            @Override
            public void run() {
                while (true){
                    Date date=new Date();
                    SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    String s = sdf.format(date);
                    System.out.println(s);
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };
        executorService.submit(r);
    }
}
